home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Produtividade / Software2 / Product4 / Setup.exe / drupal-4.6.0 / scripts / prefix.sh < prev   
Encoding:
Linux/UNIX/POSIX Shell Script  |  2004-11-24  |  366 b   |  22 lines

  1. #!/bin/sh
  2.  
  3. if [ $# != 2 ]; then
  4.   cat >&2 << EOH
  5. This is Drupal database prefixer.
  6.  
  7. Usage:
  8.   $0 prefix original_db.sql >prefixed_db.sql
  9.  
  10. - all tables will prefixed with 'prefix'
  11. EOH
  12.  
  13. exit 1;
  14. fi
  15.  
  16. PRFX=$1;
  17. sed "s/^CREATE TABLE /CREATE TABLE $PRFX/;
  18.      s/^INSERT INTO /INSERT INTO $PRFX/;
  19.      s/^REPLACE /REPLACE $PRFX/;
  20.      s/^ALTER TABLE /ALTER TABLE $PRFX/" $2
  21.  
  22.